package org.common.util;

import org.common.util.jwt.JWTHelper;
import org.common.util.jwt.JWTInfo;

public class JWTHelpUtil {

	public static Object getToken(JWTInfo info) throws Exception {
		
		JWTInfo in=new JWTInfo(info.getName(),info.getId(),info.getUniqueName());
		return JWTHelper.generateToken(in,
				"D:\\company\\glt\\glt\\application\\common\\src\\main\\resources\\pri.txt",20000000);
		
		
	}
	
	public static Object auth(String token) throws Exception {
		return JWTHelper.parserToken (token,"D:\\company\\glt\\glt\\application\\common\\src\\main\\resources\\pub.txt");
	}
	
	/*public static void main(String args[]) throws Exception {
		
	System.out.println(getToken());	
	
	System.out.println(auth("eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ4Y2MiLCJ1c2VySWQiOiIxIiwibmFtZSI6IuaZqOaZqCIsImV4cCI6MTU3Nzk3NTc5OX0.Wi8i0buAX9oOZZrP8OORACocqrYQNNoyrWJRcmNWMmMKvja-qBu_ycWOpZLPO4kvfWgzHKcXyfBdevSW3VKUDQJ5XqfYv37BHT0qs0VRcMlBqRMtX8dAgIKpw7aW6KMy-hR4lFhqPata4ylKwPPZt1r43ByOCK3kdQT4u8r2U98"));
	}*/
	
	
	
	
	
	//	RsaKeyHelper.generateKey("C:","C:","123");
	/* KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
	  SecureRandom secureRandom = new SecureRandom("".getBytes());
	   keyPairGenerator.initialize(1024, secureRandom);
        KeyPair keyPair = keyPairGenerator.genKeyPair();
        byte[] privateKeyBytes = keyPair.getPrivate().getEncoded();*/

	


/*	System.out.println(JWTHelper.parserToken("eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ4Y2MiLCJ1c2VySWQiOiIxIiwibmFtZSI6IuaZqOaZqCIsImV4cCI6MTU1Nzk5NDE0NH0.TnGl2kLougrCocCUS68dfdWvidzrv9pzpvXuHum_90QzCG_Sql12zR1POe3kO6Mdsx815ymQtcWh3Ophx_s-MRFrF_JTOToDbDVlPyz"
			+ "VGv9TWBFjewYBK2FRhPiAjzR7vpuU_bC7h6zMBriRuDcz_9XRxuoaDeVzDLmKVj9AqQE",
			"D:\company\glt\glt\application\common\src\main\resources\pub.txt"));*/








			//	JWTHelper.generateToken(in, keyConfiguration.getServicePriKey(), 30);
	
	
	
	
}
